function init() {
    this.ec01_line();
    this.ec02_line();
    this.ec01_bar([158, 142, 137, 136, 136, 134, 131, 131, 130, 129]);
    this.ec03_line();
    this.ec04_line();
    this.ec05_pie();
    this.ec06_pie();
}

//获取当前时间
function CurentTime() {
    var now = new Date();
    var year = now.getFullYear();       //年
    var month = now.getMonth() + 1;     //月
    var day = now.getDate();            //日
    var clock = year + " 年 ";
    if (month < 10)
        clock += "0";
    clock += month + " 月 ";
    if (day < 10)
        clock += "0";
    clock += day + " 日 ";
    return (clock);
}

function CurentHour() {
    var now = new Date();
    var hh = now.getHours();            //时
    var mm = now.getMinutes();          //分
    var clock = hh;
    if (hh < 10)
        clock += "0";
    clock = hh + " : ";
    if (mm < 10) clock += '0';
    clock += mm;
    return (clock);
}

//一带一路国家总指数趋势
function ec01_line() {
    let ec01_line = echarts.init($("#ec01_line_trend")[0]);
    ec01_line.setOption(com_line);
    ec01_line.setOption({
        xAxis: {
            data: ['2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018']
        },
        series: [{
            data: [103, 98, 108, 110, 109, 111, 113, 105, 113, 124],
        }].map(item => {
            return $.extend({}, com_lineSeries, item)
        })
    });
}

//一带一路发展潜力TOP5
function ec02_line() {
    let ec02_line = echarts.init($("#ec02_line_trend")[0]);
    ec02_line.setOption(com_line);
    ec02_line.setOption({
        legend: {
            show: true,
            // data:['俄罗斯','印度','巴西','印度尼西亚','泰国'],
        },
        xAxis: {
            data: ['2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018']
        },
        series: [
            {
                name: '俄罗斯',
                data: [164, 162, 173, 176, 179, 179, 175, 168, 173, 172]
            },
            {
                name: '印度',
                data: [151, 158, 163, 160, 159, 161, 166, 168, 169, 161]
            },
            {
                name: '巴西',
                data: [157, 153, 165, 163, 160, 162, 161, 151, 153, 154]
            },
            {
                name: '印度尼西亚',
                data: [143, 144, 150, 150, 151, 151, 150, 150, 151, 147]
            },
            {
                name: '泰国',
                data: [136, 133, 145, 141, 149, 146, 143, 146, 148, 145]
            },
        ].map(item => {
            return $.extend({}, com_lineSeries, item)
        })
    });
}

//一带一路国家发展指数TOP10
function ec01_bar(data) {
    let ec01_line = echarts.init($("#ec01_bar_trend")[0]);
    ec01_line.clear();
    ec01_line.setOption(com_bar_vertical);
    ec01_line.setOption({
        xAxis: {
            type: 'category',
            data: ['印度尼西亚', '新加坡', '巴基斯坦', '俄罗斯', '越南', '波兰', '土耳其', '马来西亚', '印度', '卡塔尔']
        },
        yAxis: {
            type: 'value'
        },
        series: [{
            showSymbol: false,
            smooth: true,
            data: data,
            type: 'bar',
            itemStyle: {
                normal: {
                    color: new echarts.graphic.LinearGradient(
                        0, 0, 0, 1,
                        [
                            {offset: 1, color: '#227cff'},
                            //{offset: 0.5, color: '#188df0'},
                            {offset: 0, color: '#2377fe'}
                        ]
                    )
                },
                /*  emphasis: {
                      color: new echarts.graphic.LinearGradient(
                          0, 0, 0, 1,
                          [
                              {offset: 0, color: '#2378f7'},
                              {offset: 0.7, color: '#2378f7'},
                              {offset: 1, color: '#83bff6'}
                          ]
                      )
                  }*/
            },
        }]
    });
}

//一带一路发展趋势TOP5
function ec03_line() {
    let ec03_line = echarts.init($("#ec03_line_trend")[0]);
    ec03_line.setOption(com_line);
    ec03_line.setOption({
        legend: {
            show: true,
            data: ['印度尼西亚', '印度', '土耳其', '俄罗斯', '越南'],
        },
        xAxis: {
            data: ['2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018']
        },
        series: [
            {
                name: '印度尼西亚',
                data: [152, 153, 179, 170, 162, 165, 158, 172, 183, 187]
            },
            {
                name: '印度',
                data: [178, 166, 181, 203, 171, 176, 174, 173, 185, 184]
            },
            {
                name: '土耳其',
                data: [147, 125, 170, 162, 147, 162, 168, 156, 149, 183]
            },
            {
                name: '俄罗斯',
                data: [168, 120, 185, 190, 157, 145, 171, 151, 164, 178]
            },
            {
                name: '越南',
                data: [142, 137, 145, 152, 148, 161, 151, 161, 161, 164]
            },
        ].map(item => {
            return $.extend({}, com_lineSeries, item)
        })
    });
}

//一带一路沿线国家能源业指数
function ec04_line() {
    let ec03_line = echarts.init($("#ec02_bar_trend")[0]);
    ec03_line.clear();
    ec03_line.setOption(com_line);
    ec03_line.setOption({
        legend: {
            show: true,
            top: 0,
            right: 0,
            data: ['能源业规模和增速', '能源业项目热度', '能源业指数'],
        },
        xAxis: {
            type: 'category',
            data: ['2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018']
        },
        yAxis: {
            type: 'value'
        },
        series: [//线
            $.extend({}, {
                name: '能源业规模和增速',
                data: [118, -5, 170, 125, 90, 120, 100, 45, 90, 125]
            }, com_lineSeries),
        ].concat([{ //柱
                name: '能源业项目热度',
                data: [30, 30, 65, 70, 40, 50, 58, 60, 70, 90]
            },{
                    name: '能源业指数',
                    data: [100, 50, 130, 120, 105, 120, 120, 90, 110, 140]
                }].map(item => {
                return $.extend({}, com_lineBarSeries, item)
            })
        )
    });
}

//能源业新签合同额区域分布
function ec05_pie() {
    let ec01_pie = echarts.init($("#ec01_pie_trend")[0]);
    ec01_pie.clear();
    ec01_pie.setOption(com_pie);
    ec01_pie.setOption({
        legend:{
            bottom:'4%'
        },
        series: [
            {
                color: ['#1f4c9d', '#0275f4', '#45a9f5', '#49e5cd', '#45a9f5', '#4589f4'],
                type: 'pie',
                radius: [30, 90],
                center: ['50%', '46%'],
                roseType: 'radius',
                label: {
                    normal: {
                        textStyle: {
                            color: '#666',
                            fontSize: 14 * bodyScale,
                        }
                    }
                },
                labelLine: {
                    normal: {
                        lineStyle: {
                            color: '#1f4c9d'
                        },
                        smooth: 0.2,
                        length: 5,
                        length2: 5
                    }
                },
                itemStyle: {
                    normal: {
                        /* color: new echarts.graphic.LinearGradient(
                             0, 0, 0, 1,
                             [
                                 {offset: 1, color: '#1f4c9d'},
                                 {offset: 0.5, color: '#45a9f5'},
                                 {offset: 0, color: '#49e5cd'}
                             ]
                         ),*/
                        shadowBlur: 20,
                        shadowOffsetX: 2,
                        shadowColor: 'rgba(255, 255, 255, 0.1)'
                    }
                },
                data: [
                    {value: 0, name: '北非'},
                    {value: 1, name: '东亚'},
                    {value: 3, name: '中亚'},
                    {value: 4, name: '中东欧'},
                    {value: 5, name: '葡语国家'},
                    {value: 7, name: '其他'},
                    {value: 25, name: '西亚'},
                    {value: 25, name: '东南亚'},
                    {value: 30, name: '南亚'}
                ]
            }
        ]
    });
}

//能源业产值区域分布
function ec06_pie() {
    let ec02_pie = echarts.init($("#ec02_pie_trend")[0]);
    ec02_pie.clear();
    ec02_pie.setOption(com_pie);
    ec02_pie.setOption({
        series: [
            {
                color: ['#1f4c9d', '#0275f4', '#45a9f5', '#49e5cd', '#45a9f5', '#4589f4'],
                type: 'pie',
                radius: [30, 90],
                center: ['50%', '50%'],
                roseType: 'radius',
                label: {
                    normal: {
                        textStyle: {
                            color: '#666',
                            fontSize: 14 * bodyScale
                        }
                    }
                },
                labelLine: {
                    normal: {
                        lineStyle: {
                            color: '#1f4c9d'
                        },
                        smooth: 0.2,
                        length: 5,
                        length2: 5
                    }
                },
                itemStyle: {
                    normal: {
                        // color: new echarts.graphic.LinearGradient(
                        //     0, 0, 0, 1,
                        //     [
                        //         {offset: 1, color: '#1f4c9d'},
                        //         {offset: 0.5, color: '#45a9f5'},
                        //         {offset: 0, color: '#49e5cd'}
                        //     ]
                        // ),
                        shadowBlur: 20,
                        shadowOffsetX: 2,
                        shadowColor: 'rgba(255, 255, 255, 0.1)'
                    }
                },
                data: [
                    {value: 0, name: '北非'},
                    {value: 0, name: '东亚'},
                    {value: 3, name: '中亚'},
                    {value: 5, name: '葡语国家'},
                    {value: 10, name: '中东欧'},
                    {value: 12, name: '东南亚'},
                    {value: 20, name: '其他'},
                    {value: 25, name: '西亚'},
                    {value: 25, name: '南亚'},
                ]
            }
        ]
    });
}